﻿<Window x:Class="AvCapWPF.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cap="http://schemas.sharpsoft.net/xaml"
              xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase" 
    xmlns:l="clr-namespace:AvCapWPF"
    Name="wnd"
    Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <l:ScaleConverter x:Key="conv"></l:ScaleConverter>
      

    </Window.Resources>
        <Grid>
<cap:CapPlayer x:Name="capplayer" Width="200"/>
        
        <cap:CapDisplay x:Name="player" Width="200" CapPlayer="{Binding ElementName=capplayer}"  HorizontalAlignment="left">
            <cap:CapDisplay.RenderTransform>
                <RotateTransform x:Name="xformRotate" CenterX="176" CenterY="145" Angle="90" />
            </cap:CapDisplay.RenderTransform>
            <cap:CapDisplay.Triggers>
                <EventTrigger RoutedEvent="Image.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <!-- Translate from 1 to 750 pixels, repeated, back-and-forth  -->
                                <DoubleAnimation Storyboard.TargetName="xformRotate"
                                     Storyboard.TargetProperty="Angle"
                                     From="0" To="360" Duration="0:0:10"
                                     RepeatBehavior="Forever" />

                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </cap:CapDisplay.Triggers>



        </cap:CapDisplay>
        <cap:CapDisplay x:Name="player2" Width="800" CapPlayer="{Binding  ElementName=capplayer, diagnostics:PresentationTraceSources.TraceLevel=High}"  HorizontalAlignment="right"/>



        <HeaderedItemsControl Header="Framerate" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="55">
            <Grid>
                <Rectangle Fill="#55FF0000">
                    <Rectangle.Height>
                        <MultiBinding Converter="{StaticResource conv}">
                            <Binding ElementName="player" Path="Framerate"/>
                            <Binding ElementName="wnd" Path="ActualHeight"/>
                        </MultiBinding>
                    </Rectangle.Height>
                </Rectangle>
                <TextBlock Text="{Binding ElementName=player, Path=Framerate}"/>
                
            </Grid>
        </HeaderedItemsControl>
        
    </Grid>
</Window>
